package org.cht.model;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Copyright (C) 2007 Cape Henry Technologies Inc.
 * <p/>
 * This program is open software. It is licensed using the Apache Software
 * Foundation, version 2.0 January 2004
 * <p/>
 * <a href="mailto:dlwhitehurst@gmail.com">dlwhitehurst@gmail.com</a>
 *
 * @author David L. Whitehurst
 * @version 1.0
 */
@Entity
@Table(name="technology")
public class Technology extends BaseObject implements Serializable {


    private Long id;
    private String name;
    private List developers;

    // Default constructor
    public Technology () {
        developers = new ArrayList();
    }

    @Id
    @GeneratedValue(strategy= GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(length=80)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @ManyToMany(
    targetEntity=org.cht.model.Developer.class,
    cascade={CascadeType.PERSIST, CascadeType.MERGE}
    )
    @JoinTable(
    name="technology_developer",
    joinColumns={@JoinColumn(name="technology_id")},
    inverseJoinColumns={@JoinColumn(name="developer_id")}
    )
    public List getDevelopers() {
        return developers;
    }

    public void setDevelopers(List developers) {
        this.developers = developers;
    }
    /**
     * Returns a multi-line String with key=value pairs.
     *
     * @return a String representation of this class.
     */
    public String toString() {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    /**
     * Compares object equality. When using Hibernate, the primary key should
     * not be a part of this comparison.
     *
     * @param o object to compare to
     * @return true/false based on equality tests
     */
    public boolean equals(Object o) {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    /**
     * When you override equals, you should override hashCode. See "Why are
     * equals() and hashCode() importation" for more information:
     * http://www.hibernate.org/109.html
     *
     * @return hashCode
     */
    public int hashCode() {
        return 0;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
